<template>
  <el-dragable-dialog :title="title" v-model="formModal.visible" class="form-modal" :width="width"  >

    <template v-if="formModal.visible"><slot></slot></template> <!-- 增加v-if，每次弹窗会更新值 -->
    
    <template #footer>
      <span class="dialog-footer">
        <el-button type="primary" :loading="formModal.confirmLoading" @click="formModalHandleOk" size="medium">保存</el-button>
      </span>
    </template>
  </el-dragable-dialog>
</template>


<script lang="ts" setup>

import { ref, reactive, computed, PropType } from 'vue'
import { FormModal, IForm } from '@/common/FormModal'

const props = defineProps({
    title: { type: String, required: true },
    width: { type: Number, required: true },
    formModal: { type: Object as PropType<FormModal>, required: true },
});
const emit = defineEmits(["ok"]);
const refForm = ref();
//const formModal = reactive(new FormModal());//表单弹窗

const formModalHandleOk= ()=>{
  emit('ok');
}

</script>